<template>
  <div class="home-swiper">
    <swiper class="swiper" :options="swiperOption">
      <swiper-slide v-for="item in swiperList" :key="item.id">
        <img :src="item.imgUrl" class="swiper-img" alt />
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
import { Swiper, SwiperSlide, directive } from 'vue-awesome-swiper'
import 'swiper/css/swiper.css'

export default {
  name: 'HomeSwiper',
  components: { Swiper, SwiperSlide },
  data () {
    return {
      swiperOption: {
        loop: true,
        autoplay: {
          delay: 3000,
          stopOnLastSlide: false,
          disableOnInteraction: false
        },
        pagination: {
          el: ".swiper-pagination",
          // type: 'fraction',
          // clickable: true //允许分页点击跳转
        },
      },
      swiperList: [
        { id: 's0001', imgUrl: 'http://iph.href.lu/640x200?text=image1&fg=666666&bg=f9cb9c' },
        { id: 's0002', imgUrl: 'http://iph.href.lu/640x200?text=image2&fg=666666&bg=b6d7a8' }
      ],

    }
  },

};
</script>

<style lang="stylus" scoped>
.home-swiper >>> .swiper-pagination
  color white
  .swiper-pagination-bullet-active
    background white
.home-swiper
  overflow hidden
  width 100%
  height 0
  padding-bottom 31.5%
  .swiper-img
    width 100%
</style>